//
//  WKFansListCell.m
//  WKMaybell
//
//  Created by 何文虎 on 2018/12/21.
//  Copyright © 2018 何文虎. All rights reserved.
//

#import "WKFansListCell.h"

@interface WKFansListCell ()
@property(nonatomic,strong)UIImageView *headerImgView;
@property(nonatomic,strong)UILabel *nameLb;
@property(nonatomic,strong)UILabel *detailLb;
@end

@implementation WKFansListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setup];
    }
    return self;
}

- (void)setup{
    [self.contentView addSubview:self.headerImgView];
    [self.headerImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(12);
        make.size.mas_equalTo(CGSizeMake(36, 36));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    [self.contentView addSubview:self.nameLb];
    [self.nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.headerImgView.mas_top);
        make.left.mas_equalTo(self.headerImgView.mas_right).offset(11);
        make.size.mas_equalTo(CGSizeMake(250, 15));
    }];
    
    [self.contentView addSubview:self.detailLb];
    [self.detailLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.nameLb.mas_bottom).offset(7);
        make.left.mas_equalTo(self.nameLb.mas_left);
        make.size.mas_equalTo(CGSizeMake(250, 11));
    }];
    
    _headerImgView.layer.cornerRadius = 36/2;
    _headerImgView.layer.masksToBounds = YES;
    _headerImgView.contentMode = UIViewContentModeScaleAspectFill;
    
    [_headerImgView sd_setImageWithURL:[NSURL URLWithString:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545381177187&di=2c1b1c0c9f7a01bde58ad9853289b78c&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201405%2F28%2F20140528185644_N3Xfe.thumb.700_0.jpeg"] placeholderImage:nil];
    _nameLb.text = @"会飞的一只猫";
    _detailLb.text = @"70条动态 | 1066个赞";
}

- (UIImageView*)headerImgView{
    if (!_headerImgView) {
        _headerImgView = [[UIImageView alloc]init];
    }
    return _headerImgView;
}

- (UILabel*)nameLb{
    if (!_nameLb) {
        _nameLb = [[UILabel alloc]init];
        _nameLb.textColor = UIColorFromHex(0x3C3C3C);
        _nameLb.font = PFSC_MediumFont(15);
    }
    return _nameLb;
}

- (UILabel*)detailLb{
    if (!_detailLb) {
        _detailLb = [[UILabel alloc]init];
        _detailLb.textColor = UIColorFromHex(0x979797);
        _detailLb.font = PFSC_MediumFont(11);
    }
    return _detailLb;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
